Re: Multiple Primary Keys - Mailing list pgsql-novice

From samsom, debra
Subject Re: Multiple Primary Keys
Date
Msg-id 7adb3e54040c7707d2@[10.1.1.200]
Whole thread Raw
In response to Multiple Primary Keys  ("samsom, debra" <dsamsom@bristol.ca>)
List pgsql-novice

> Yes, it could be.  Certain characters, such as \ and <tab> can cause
> COPY to misbehave.  Can you post your full tabledef, plus a few lines
> of the COPY file?

psql dc postgres -c "create table "attachments"(
  "docn" varchar(25) NOT NULL,
  "issue" varchar(6) NOT NULL,
  "docna" varchar(4) NOT NULL,
  "issuea" varchar(20) NOT NULL,
  "applic" varchar(3),
  "whereused" varchar(1),
  CONSTRAINT "attachments_pkey"
  PRIMARY KEY ("docn","issue","docna","issuea"));"

docn                            issue     docna                           issuea

012T2100 SHT 01                   K001  DR 911380                         A001         
012T2100 SHT 01                   L001  012T2100 SHT 01 ADCN 267          -001         
012T2100 SHT 01                   L001  012T2100 SHT 01 ADCN 268          -001         
012T2100 SHT 01                   L001  012T2100 SHT 01 ADCN 270          -001         
012T2100 SHT 01                   L001  012T2100 SHT 01 ADCN 271          -001         
012T2100 SHT 01                   L001  012T2100 SHT 01 ADCN 272          -001

The duplicate error is on the third line of data ..
The headings are for your reference only, they aren't really in the file.  It's also a tab delimited file.

-----Original Message-----
From: Josh Berkus [mailto:josh@agliodbs.com]
Sent: Thursday, April 18, 2002 11:07 AM
To: samsom, debra; pgsql-novice@postgresql.org
Subject: Re: [NOVICE] Multiple Primary Keys

Debra,

> It will be tough redesigning the database to use a surrogate key,
> cause it
> links to other tables using this key and I can't lose this
> relationship.

OK.  Just keep it in mind for the next database ;-)

> I ran the select query (looking for duplicate data) and the result
> returned
> 0 rows.  I have also run this copy using just a few records that I
> know are
> unique with the same result.
>
> Unfortunately these fields do contain spaces and funny characters,
> could
> this be the problem??

Yes, it could be.  Certain characters, such as \ and <tab> can cause
COPY to misbehave.  Can you post your full tabledef, plus a few lines
of the COPY file?

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Aggregate Network Address functions?
Next
From: "Josh Berkus"
Date:
Subject: Re: Multiple Primary Keys